feat: add plot/charts/scatter/ctor - #14299
Conversation
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown_pkg_readmes
status: na
- task: lint_markdown_docs
status: na
- task: lint_markdown
status: na
- task: lint_package_json
status: passed
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
@Sachinn-64 Interestingly, in your demo plot above, the legend shows the symbols, but all the plot markers are dots. |
| function encoding( name, scales ) { | ||
| return new SymbolEncoding({ | ||
| 'update': new SymbolEncodingSet({ | ||
| 'fill': ordinalValue( getScale( scales, 'color' ), name ), |
There was a problem hiding this comment.
Okay, so this is an interesting one. For certain symbols, they should not be filled. E.g., I should be able to create an unfilled circle. Meaning, we encode the stroke, but not the fill. That is the intent behind distinguishing "circle" (unfilled) from "dot" (filled).
One could argue that we should be able to do the same for filled and unfilled triangles, stars, diamonds, etc.
But then some symbols don't have a fill (e.g., stroke, asterisk, cross, x, etc).
I am not sure how we should handle this. MATLAB makes a distinction between "face" (i.e., fill) and "edge" (i.e., stroke) color. Ref: https://www.mathworks.com/help/matlab/ref/scatter.html
At least in MATLAB, if you specify "filled", certain symbols which don't have "faces" don't work.
My initial thinking is that we need a separate property to allow specifying fill colors independently of edge/stroke colors.
In which case, we could have the following properties:
- legend: toggle legend
- symbols: symbol shapes (
shape) - colors: primary symbol colors (
fill) - edgeColors: edge colors for those symbols supporting edges (e.g., triangle, circle, diamond, etc) (
stroke) - symbolOpacity: symbol opacities (
fillOpacity) - edgeOpacity: edge opacities (
strokeOpacity) - symbolSize: symbol sizes (
size) - edgeWidth: edge widths (
strokeWidth)
We should allow the "edge" properties to be unset (i.e., explicitly set to undefined). Modulo logic still applies for the edge* properties. For those symbols which are all "edge", such as stroke or cross, edgeColors should take precedent over colors.
This means that the encoding logic will be a bit more complicated than what is done here and will depend on what has been set. E.g., if edgeWidth has not been set, we should not encode a strokeWidth property.
Does that make sense?
There was a problem hiding this comment.
Hmm...we'd also need to support "unsetting" the colors property, I suppose, in order to support "hollow" symbols.
There was a problem hiding this comment.
Another follow-up: given the direction of being able to independently set fill and edge color, that makes the distinction between circle and dot less necessary, unless dot truly is a "dot" (individual pixel), which I could see being potentially useful for very large datasets. That may require updating the SVG path string accordingly.
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown_pkg_readmes
status: na
- task: lint_markdown_docs
status: na
- task: lint_markdown
status: na
- task: lint_package_json
status: passed
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
kgryte
left a comment
There was a problem hiding this comment.
The changes look good. Now, you just need to add "edge" support.
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown_pkg_readmes
status: na
- task: lint_markdown_docs
status: na
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Resolves None.
Description
This pull request:
plot/charts/scatter/ctorRelated Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
{{TODO: add disclosure if applicable}}
@stdlib-js/reviewers